/**
 @file ctc_qos.h

 @date 2010-5-25

 @version v2.0

 This file contains all acl related data structure, enum, macro and proto.
*/

#ifndef _CTC_QOS_H_
#define _CTC_QOS_H_

#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************
 *
 * Header Files
 *
 ***************************************************************/

#include "ctc_const.h"
#include "ctc_field.h"

/****************************************************************
*
* Defines and Macros
*
****************************************************************/

/****************************************************************
*
* Data Structures
*
****************************************************************/

#define CTC_MAX_QUEUE_CLASS_NUM     4
#define CTC_RESC_DROP_PREC_NUM      4
#define CTC_DROP_PREC_NUM           4
#define CTC_RESRC_MAX_CONGEST_LEVEL_NUM             8
#define CTC_RESRC_MAX_CONGEST_LEVEL_THRD_NUM        7
#define CTC_MAX_FCDL_DETECT_NUM     2

#define CTC_QOS_SHP_TOKE_THRD_DEFAULT 0xFFFFFFFF
/**
 @defgroup qos QOS
 @{
*/

/**
 @brief QoS color
*/
enum ctc_qos_color_e
{
    CTC_QOS_COLOR_NONE,     /**< [GB.GG.D2.TM.TMM.TMA.AT] None color */
    CTC_QOS_COLOR_RED,      /**< [GB.GG.D2.TM.TMM.TMA.AT] Red color: the lowest drop precedence */
    CTC_QOS_COLOR_YELLOW,   /**< [GB.GG.D2.TM.TMM.TMA.AT] Yellow color: the mild drop precedence */
    CTC_QOS_COLOR_GREEN,    /**< [GB.GG.D2.TM.TMM.TMA.AT] Green color: the highest drop precedence */

    MAX_CTC_QOS_COLOR
};
typedef enum ctc_qos_color_e ctc_qos_color_t;

/**
 @brief qos trust type
*/
enum ctc_qos_trust_type_e
{
    CTC_QOS_TRUST_PORT        = 0,       /**< [GB.GG.D2.TM.TMM.TMA.AT] trust Port */
    CTC_QOS_TRUST_OUTER       = 1,       /**< [GB.GG.D2.TM.TMM.AT] copy outer */
    CTC_QOS_TRUST_COS         = 2,       /**< [GB.GG.D2.TM.TMM.AT] trust COS */
    CTC_QOS_TRUST_DSCP        = 3,       /**< [GB.GG.D2.TM.TMM.TMA.AT] trust DSCP */
    CTC_QOS_TRUST_IP          = 4,       /**< [GB.GG] trust IP Precedence */
    CTC_QOS_TRUST_STAG_COS    = 5,       /**< [GB.GG.D2.TM.TMM.TMA.AT] trust stag-cos */
    CTC_QOS_TRUST_CTAG_COS    = 6,       /**< [GB.GG.D2.TM.TMM.AT] trust ctag-cos */
    CTC_QOS_TRUST_MAX
};
typedef enum ctc_qos_trust_type_e ctc_qos_trust_type_t;

/**
 @brief Qos domain mapping type
*/
enum ctc_qos_domain_map_type_e
{
    CTC_QOS_DOMAIN_MAP_IGS_COS_TO_PRI_COLOR,      /**< [GB.GG.D2.TM.TMM.TMA.AT] Mapping ingress cos +  dei to priority + color */
    CTC_QOS_DOMAIN_MAP_IGS_DSCP_TO_PRI_COLOR,     /**< [GB.GG.D2.TM.TMM.TMA.AT] Mapping ingress dscp + ecn to priority + color */
    CTC_QOS_DOMAIN_MAP_IGS_IP_PREC_TO_PRI_COLOR,  /**< [GB.GG] Mapping ingress ip-precedence to priority + color */
    CTC_QOS_DOMAIN_MAP_IGS_EXP_TO_PRI_COLOR,      /**< [GB.GG.D2.TM.TMM.AT] Mapping ingress exp to priority + color */
    CTC_QOS_DOMAIN_MAP_EGS_PRI_COLOR_TO_COS,      /**< [GB.GG.D2.TM.TMM.TMA.AT] Mapping egress  priority + color to cos + cfi*/
    CTC_QOS_DOMAIN_MAP_EGS_PRI_COLOR_TO_DSCP,     /**< [GB.GG.D2.TM.TMM.TMA.AT] Mapping egress  priority + color to dscp*/
    CTC_QOS_DOMAIN_MAP_EGS_PRI_COLOR_TO_EXP,      /**< [GB.GG.D2.TM.TMM.AT] Mapping egress  priority + color to exp*/
    CTC_QOS_DOMAIN_MAP_OBM_DSCP_TO_PRI,           /**< [TMM.AT] Mapping OBM dscp to priority<0-3> */
    CTC_QOS_DOMAIN_MAP_OBM_COS_TO_PRI,            /**< [TMM.AT] Mapping OBM cos to priority<0-3> */
    CTC_QOS_DOMAIN_MAP_TYPE_MAX
};
typedef enum ctc_qos_domain_map_type_e ctc_qos_domain_map_type_t;

/**
 @brief Qos domain mapping type
*/
struct ctc_qos_domain_map_s
{
    uint8    domain_id;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Domain id <0-7>, apply on port; for D2,
                                                1. cos domain: Domain id <0-7>, apply on port/nexthop
                                                2. dscp domain: Domain id <0-15>, apply on port/interface/nexthop
                                                3. exp domain: Domain id <0-15>, apply on mpls/nexthop*/
    uint8    type;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Domain mapping type, pls refer to ctc_qos_domain_map_type_t*/

    uint8    priority;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Qos priority: <0-15> */
    uint8    color;          /**< [GB.GG.D2.TM.TMM.TMA.AT] Qos color, pls refer to ctc_qos_color_t*/
    uint8    replace_dscp;   /**< [D2.TM.TMM.AT] If set, packet src dscp/exp will be replaced new value in ingress process.*/
    uint8    new_dscp;       /**< [D2.TM.TMM.AT] New dscp/exp, valid when replace_dscp is set,
                                    type is CTC_QOS_DOMAIN_MAP_IGS_DSCP_TO_PRI_COLOR, mean new dscp,
                                    type is CTC_QOS_DOMAIN_MAP_IGS_EXP_TO_PRI_COLOR, mean new exp.
                                    in addition, CTC_QOS_GLB_CFG_TABLE_MAP will use the new_dscp to map in ingress,
                                    while ingress acl will use packet origin dscp to match.*/

    union
    {
        struct
        {
            uint8    cos;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Vlan id cos <0-7>, 0xFF for untagged map. */
            uint8    dei;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Vlan id dei <0-1>*/
        } dot1p;

        struct
        {
            uint8    dscp; /**< [GB.GG.D2.TM.TMM.TMA.AT] Ip dscp <0-63>*/
            uint8    ecn;  /**< [GB.GG] Ip ecn <0-3>*/
        } tos;

        uint8    exp;      /**< [GB.GG.D2.TM.TMM.AT] Mpls exp <0-7>*/
        uint8    ip_prec;  /**< [GB.GG] Ip precedence <0-7>*/

    } hdr_pri;

};
typedef struct ctc_qos_domain_map_s ctc_qos_domain_map_t;


/**
 @brief Qos table mapping type
*/
enum ctc_qos_table_map_type_e
{
    CTC_QOS_TABLE_MAP_IGS_COS_TO_COS  = 0x0001,      /**< [D2.TM.TMM.AT] Mapping ingress cos to cos */
    CTC_QOS_TABLE_MAP_IGS_DSCP_TO_COS = 0x0002,      /**< [D2.TM.TMM.AT] Mapping ingress dscp to cos */
    CTC_QOS_TABLE_MAP_IGS_COS_TO_DSCP = 0x0004,      /**< [D2.TM.TMM.AT] Mapping ingress cos to dscp */
    CTC_QOS_TABLE_MAP_IGS_DSCP_TO_DSCP = 0x0008,     /**< [D2.TM.TMM.AT] Mapping ingress dscp to dscp */
    CTC_QOS_TABLE_MAP_TYPE_MAX
};
typedef enum ctc_qos_table_map_type_e ctc_qos_table_map_type_t;

/**
 @brief Qos table mapping action type
*/
enum ctc_qos_table_map_action_type_e
{
    CTC_QOS_TABLE_MAP_ACTION_NONE,       /**< [D2.TM.TMM.AT] None */
    CTC_QOS_TABLE_MAP_ACTION_COPY,       /**< [D2.TM.TMM.AT] Keep original value */
    CTC_QOS_TABLE_MAP_ACTION_MAP,        /**< [D2.TM.TMM.AT] Use value from table map */
    CTC_QOS_TABLE_MAP_ACTION_MAX
};
typedef enum ctc_qos_table_map_action_type_e ctc_qos_table_map_action_type_t;

/**
 @brief Qos table mapping
*/
struct ctc_qos_table_map_s
{
    uint8    table_map_id;   /**< [D2.TM.TMM.TMA.AT] Table map id */
    uint8    type;           /**< [D2.TM.TMM.TMA.AT] Table mapping type, pls refer to ctc_qos_table_map_type_t*/
    uint8    action_type;    /**< [D2.TM.TMM.TMA.AT] Table mapping action type, pls refer to ctc_qos_table_map_action_type_t*/
    uint8    in;             /**< [D2.TM.TMM.TMA.AT] Input value */
    uint8    out;            /**< [D2.TM.TMM.TMA.AT] Output value*/
    uint8    rsv[3];
};
typedef struct ctc_qos_table_map_s ctc_qos_table_map_t;

/**
 @brief Qos oobfc mode
*/
enum ctc_qos_oobfc_mode_e
{
    CTC_QOS_OOBFC_MODE_TX_EGRESS,        /**< [TM.TMM] Egress oobfc request*/
    CTC_QOS_OOBFC_MODE_TX_INGRESS,       /**< [TM.TMM] Ingress oobfc request*/
    CTC_QOS_OOBFC_MODE_RX_EGRESS,        /**< [TM.TMM] Response egress oobfc request */
    CTC_QOS_OOBFC_MODE_RX_INGRESS,       /**< [TM.TMM] Response ingress oobfc request*/
    CTC_QOS_OOBFC_MODE_MAX
};
typedef enum ctc_qos_oobfc_mode_e ctc_qos_oobfc_mode_t;

/**
 @brief Qos out of band flow control
*/
struct ctc_qos_oobfc_s
{
    uint8  mode;                    /**< [TM.TMM] [RX,TX] The oobfc mode, refer to ctc_qos_oobfc_mode_t*/
    uint8  is_pfc;                  /**< [TM.TMM] [RX,TX] Is pfc */
    uint8  enable;                  /**< [TM.TMM] [RX,TX] Enable oobfc*/
    uint8  port_offset;             /**< [TM.TMM] [TX] Port offset in port and group map*/
    uint8  gchip_id;                /**< [TM.TMM] [TX] Global chip id, used for port bitmap*/
    ctc_port_bitmap_t port_bitmap;  /**< [TM.TMM] [TX] Port bitmap for port which support oobfc*/
};
typedef struct ctc_qos_oobfc_s ctc_qos_oobfc_t;

/**
 @brief Qos policer type
*/
enum ctc_qos_policer_type_e
{
    CTC_QOS_POLICER_TYPE_PORT,           /**< [GB.GG.D2.TM.TMM.TMA.AT] Port policer (support ing and egs) */
    CTC_QOS_POLICER_TYPE_FLOW,           /**< [GB.GG.D2.TM.TMM.TMA.AT] Flow policer (support ing and egs)*/
    CTC_QOS_POLICER_TYPE_VLAN,           /**< [D2.TM.TMM.AT] Vlan policer (support ing and egs) */
    CTC_QOS_POLICER_TYPE_SERVICE,        /**< [GB.GG.TMM.AT] Service policer (only support ingress) */
    CTC_QOS_POLICER_TYPE_COPP,           /**< [D2.TM.TMM.AT] Control Plane Policing (D2&TM only support igs,TMM support ing and egs) */
    CTC_QOS_POLICER_TYPE_MFP,            /**< [TM] Ipfix MFP (support ing and egs)*/
    CTC_QOS_POLICER_TYPE_CHAN,           /**< [AT] Channel policer (only support egs) */
    CTC_QOS_POLICER_TYPE_MAX
};
typedef enum ctc_qos_policer_type_e ctc_qos_policer_type_t;

/**
 @brief Qos policer mode
*/
enum ctc_qos_policer_mode_e
{
    CTC_QOS_POLICER_MODE_STBM,       /**< [D2.TM.TMM.TMA.AT]       Single Token Bucket Meter */
    CTC_QOS_POLICER_MODE_RFC2697,    /**< [GB.GG.D2.TM.TMM.TMA.AT] RFC2697 srTCM */
    CTC_QOS_POLICER_MODE_RFC2698,    /**< [GB.GG.D2.TM.TMM.TMA.AT] RFC2698 trTCM */
    CTC_QOS_POLICER_MODE_RFC4115,    /**< [GB.GG.D2.TM.TMM.TMA.AT] RFC4115 mode enhanced trTCM*/
    CTC_QOS_POLICER_MODE_MEF_BWP,    /**< [GB.GG.D2.TM.TMM.TMA.AT] MEF BWP(bandwidth profile) */
    CTC_QOS_POLICER_MODE_MAX
};
typedef enum ctc_qos_policer_mode_e ctc_qos_policer_mode_t;


/**
 @brief Qos policer level
*/
enum ctc_qos_policer_level_e
{
    CTC_QOS_POLICER_LEVEL_NONE,        /**< [D2.TM.TMM.AT] None level */
    CTC_QOS_POLICER_LEVEL_0,           /**< [D2.TM.TMM.AT] Policer level 0*/
    CTC_QOS_POLICER_LEVEL_1,           /**< [D2.TM.TMM.AT] Policer level 1 */
    CTC_QOS_POLICER_LEVEL_MAX
};
typedef enum ctc_qos_policer_level_e ctc_qos_policer_level_t;

/**
 @brief Qos policer 2 level color merge mode
*/
enum ctc_qos_policer_color_merge_mode_e
{
    CTC_QOS_POLICER_COLOR_MERGE_AND,    /**< [D2.TM.TMM.AT] 2 level policer color merge,the final color is low priority color */
    CTC_QOS_POLICER_COLOR_MERGE_OR,     /**< [D2.TM.TMM.AT] 2 level policer color merge,the final color is high priority color */
    CTC_QOS_POLICER_COLOR_MERGE_DUAL,   /**< [D2.TM.TMM.AT] 2 level policer color merge,if the micro color is green,the final color is green.the other situation is low priority color*/
};
typedef enum ctc_qos_policer_color_merge_mode_e ctc_qos_policer_color_merge_mode_t;

/**
 @brief Qos policer parameter
*/
struct ctc_qos_policer_param_s
{
    uint8  policer_mode;      /**< [GB.GG.D2.TM.TMM.TMA.AT] policer mode refer to ctc_qos_policer_mode_t*/

    uint8  cf_en;             /**< [GB.GG.D2.TM.TMM.AT] Only for MEF BWP, couple flag enable*/
    uint8  is_color_aware;    /**< [GB.GG.D2.TM.TMM.TMA.AT] is_color_aware = 1 for Color-aware mode, is_color_aware = 0 for Color-blind mode */

    uint8  use_l3_length;     /**< [GB.GG.D2.TM.TMM.AT] Use packet length from layer 3 header for metering */
    uint8  stats_en;          /**< [GB.GG.D2.TM.TMM.TMA.AT] enable policer stats for three color */
    uint8  stats_mode;        /**< [D2.TM.TMM.TMA.AT] Policer:stats_mode = 0 for color-aware stats, stats_mode = 1 for color-blind stats
                                                  SVC policer:stats_mode = 0 for only non-drop pkt,stats_mode = 1 for none pkt,
                                                              stats_mode = 2 for all pkt,stats_mode = 3 for only drop pkt.*/
    uint8  drop_color;        /**< [GB.GG.D2.TM.TMM.TMA.AT] the drop color after policing  */
    uint8  color_merge_mode;  /**< [D2.TM.TMM.AT] 2 level policer color merge mode refer to ctc_qos_policer_color_merge_mode_t */

    uint32 cir;  /**< [GB.GG.D2.TM.TMM.TMA.AT] Committed Information Rate (unit :kbps; if set pps_en, unit :pps)*/
    uint32 cbs;  /**< [GB.GG.D2.TM.TMM.TMA.AT] Committed Burst Size, equivalent to the C-bucket size (unit :kb; if set pps_en, unit :pkt),
                                     cbs = CTC_MAX_UINT32_VALUE is max bucket size*/

    uint32 pir;  /**< [GB.GG.D2.TM.TMM.TMA.AT] PIR(RFC2698) or EIR(RFC4115,BWP) (unit :kbps; if set pps_en, unit :pps)*/
    uint32 pbs;  /**< [GB.GG.D2.TM.TMM.TMA.AT] PBS(RFC2698,)or EBS (RFC2697, RFC4115,BWP)(unit :kb; if set pps_en, unit :pkt),
                                     pbs = CTC_MAX_UINT32_VALUE is max bucket size*/
};
typedef struct ctc_qos_policer_param_s ctc_qos_policer_param_t;

/**
 @brief Qos policer Hierarchical Bandwidth Profile.
   1.1, when bwp is applied to MEF10.3,the relationship between the cos index
        and the cos level is as follows :
         Cos level    Cos index
        -------------------------
          3            1
          2            2
          1            3
        ------------------------
   1.2, when bwp is applied to triple_play mode,the cos index =0 is total policer
        service;
*/
struct ctc_qos_policer_hbwp_s
{
    uint8  cos_index;     /**< [GB.GG.D2.TM.TMM.AT] Cos Level */
    uint8  sf_en;         /**< [GB.GG.D2.TM.TMM.AT] Share flag enable*/
    uint8  triple_play;   /**< [GG] if set, cos_index = 0 regard as total policer */
    uint8  rsv;

    uint8  sp_en;         /**< [GB.GG] Strict schedule enable*/
    uint8  cf_total_dis;  /**< [GB.GG.D2.TM.TMM.AT] Coupling total disable */
    uint16 weight;        /**< [GB.GG] Weight value<0-0x3FF>, only support cos 1 weight, cos 0 is (0x3FF - Weight)*/

    uint32 cir_max;       /**< [GB.GG.D2.TM.TMM.AT] Max Cir rate,(unit:kbps; if set pps_en, unit :pps)*/
    uint32 pir_max;       /**< [GB.GG.D2.TM.TMM.AT] Max Eir rate,(unit:kbps; if set pps_en, unit :pps)*/
};
typedef struct ctc_qos_policer_hbwp_s ctc_qos_policer_hbwp_t;

/**
 @brief Qos policer action flag
*/
enum ctc_qos_policer_action_flag_e
{
    CTC_QOS_POLICER_ACTION_FLAG_PRIORITY_GREEN_VALID    = 1U << 0,  /**< [D2.TM.TMM.TMA.AT] Green priority valid*/
    CTC_QOS_POLICER_ACTION_FLAG_PRIORITY_YELLOW_VALID   = 1U << 1,  /**< [D2.TM.TMM.TMA.AT] Yellow priority valid*/
    CTC_QOS_POLICER_ACTION_FLAG_PRIORITY_RED_VALID      = 1U << 2,  /**< [D2.TM.TMM.TMA.AT] Red priority valid*/
    CTC_QOS_POLICER_ACTION_FLAG_DROP_GREEN              = 1U << 3,  /**< [D2.TM.TMM.TMA.AT] Drop green */
    CTC_QOS_POLICER_ACTION_FLAG_DROP_YELLOW             = 1U << 4,  /**< [D2.TM.TMM.TMA.AT] Drop yellow */
    CTC_QOS_POLICER_ACTION_FLAG_DROP_RED                = 1U << 5   /**< [D2.TM.TMM.TMA.AT] Drop red */
};
typedef enum ctc_qos_policer_action_flag_e ctc_qos_policer_action_flag_t;

/**
 @brief Qos policer action
*/
struct ctc_qos_policer_action_s
{
    uint32 flag;                /**< [D2.TM.TMM.TMA.AT] qos action flag, refer to ctc_qos_policer_action_flag_t*/
    uint8  prio_green;          /**< [D2.TM.TMM.TMA.AT] Green priority*/
    uint8  prio_yellow;         /**< [D2.TM.TMM.TMA.AT] Yellow priority*/
    uint8  prio_red;            /**< [D2.TM.TMM.TMA.AT] Red priority*/
    uint8  rsv;
};
typedef struct ctc_qos_policer_action_s ctc_qos_policer_action_t;


/**
 @brief Qos policer data structure
*/
struct ctc_qos_policer_s
{
    uint8  type;    /**< [GB.GG.D2.TM.TMM.TMA.AT]  Policer type, refer to ctc_qos_policer_type_t*/
    uint8  dir;     /**< [GB.GG.D2.TM.TMM.TMA.AT]  Ingress or egress , refer to ctc_direction_t, for Port policer and Vlan policer */
    uint8  enable;  /**< [GB.GG.D2.TM.TMM.TMA.AT]  Policer enable or disable*/
    uint8  hbwp_en; /**< [GB.GG.D2.TM.TMM.AT]      MEF BWP enable or disable*/

    uint8  level;   /**< [D2.TM.TMM.AT] Policer level, refer to ctc_qos_policer_level_t*/
    uint8  pps_en;  /**< [D2.TM.TMM.AT] Policer PPS mode enable*/
    uint16 gran;    /**< [D2.TM.TMM.AT] Policer rate granularity, 0 indicate invalid, (unit:kbps)*/

    union
    {
        uint16 policer_id;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Flow policer and HBWP id <1-0xFFFF>*/
        uint16 service_id;      /**< [GB] Service ID <1-0xFFFF>*/
        uint16 vlan_id;         /**< [D2.TM.TMM.TMA.AT] Vlan ID */
        uint32 gport;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port*/
    } id;

    ctc_qos_policer_hbwp_t hbwp;       /**< [GB.GG.D2.TM.TMM.AT]  MEF Bandwidth Profile*/
    ctc_qos_policer_param_t policer;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Policer parameter info*/
    ctc_qos_policer_action_t action;   /**< [D2.TM.TMM.TMA.AT] Policer action*/
};
typedef struct ctc_qos_policer_s ctc_qos_policer_t;

/**
 @brief Qos policer stats info
*/
struct ctc_qos_policer_stats_info_s
{
    uint64 confirm_pkts;        /**< [GB.GG.D2.TM.TMM.TMA.AT] Total number of packets with color green*/
    uint64 confirm_bytes;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Total bytes of packets with color green*/
    uint64 exceed_pkts;         /**< [GB.GG.D2.TM.TMM.TMA.AT] Total number of packets with color yellow*/
    uint64 exceed_bytes;        /**< [GB.GG.D2.TM.TMM.TMA.AT] Total bytes of packets with color yellow*/
    uint64 violate_pkts;        /**< [GB.GG.D2.TM.TMM.TMA.AT] Total number of packets with color red*/
    uint64 violate_bytes;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Total bytes of packets with color red*/
};
typedef struct ctc_qos_policer_stats_info_s ctc_qos_policer_stats_info_t;

/**
 @brief Qos policer stats structure
*/
struct ctc_qos_policer_stats_s
{
    uint8 type;         /**< [GB.GG.D2.TM.TMM.TMA.AT]ctc_qos_policer_type_t*/
    uint8 dir;          /**< [GB.GG.D2.TM.TMM.AT]ctc_direction_t */
    uint8 hbwp_en;      /**< [GB.GG.D2.TM.TMM.AT] MEF BWP enable or disable*/
    uint8 cos_index;    /**< [GB.GG.D2.TM.TMM.AT] Cos Level*/

    union
    {
        uint16 policer_id;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Flow policer and BWP id <00xFFFF>*/
        uint16 service_id;      /**< [GB] Service ID <0xFFFF>*/
        uint16 vlan_id;         /**< [D2.TM.TMM.AT]  Vlan ID */
        uint32 gport;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port*/
    } id;
    ctc_qos_policer_stats_info_t stats; /**< [GB.GG.D2.TM.TMM.TMA.AT] Stats parameter*/

};
typedef struct ctc_qos_policer_stats_s ctc_qos_policer_stats_t;

/**
 @brief Qos global configure type
*/
enum ctc_qos_glb_cfg_type_e
{
    CTC_QOS_GLB_CFG_POLICER_EN,             /**< [GB.GG.D2.TM.TMM.AT] Global policer update enable*/
    CTC_QOS_GLB_CFG_POLICER_STATS_EN,       /**< [GB.GG] Global policer statst enable*/
    CTC_QOS_GLB_CFG_POLICER_IPG_EN,         /**< [GB.GG.D2.TM.TMM.TMA.AT] Global policer ipg enable*/
    CTC_QOS_GLB_CFG_POLICER_SEQENCE_EN,     /**< [GB.GG] Global policer port and flow sequential enable*/
    CTC_QOS_GLB_CFG_POLICER_FLOW_FIRST_EN,  /**< [GB.GG.D2.TM.AT] Global policer port and flow plicer priority,
                                                         high 16 bit is dir, low 16bit is enable value*/

    CTC_QOS_GLB_CFG_RESRC_MGR_EN,           /**< [GB.GG.D2.TM.TMM.AT] Global resource manger enable */
    CTC_QOS_GLB_CFG_QUE_SHAPE_EN,           /**< [GB.GG.D2.TM.TMM.AT] Global queue shaping enable*/
    CTC_QOS_GLB_CFG_GROUP_SHAPE_EN,         /**< [GB.GG.D2.TM.TMM] Global group shaping enable*/
    CTC_QOS_GLB_CFG_PORT_SHAPE_EN,          /**< [GB.GG.D2.TM.TMM.AT] Global port shaping  enable*/
    CTC_QOS_GLB_CFG_SHAPE_IPG_EN,           /**< [GB.GG.D2.TM.TMM.TMA.AT] Global queue shaping ipg enable*/
    CTC_QOS_GLB_CFG_QUE_STATS_EN,           /**< [GB.GG] Global queue stats enable*/
    CTC_QOS_GLB_CFG_PHB_MAP,                /**< [GB.GG.D2.TM.TMM.AT] Priority mapped to phb*/
    CTC_QOS_GLB_CFG_REASON_SHAPE_PKT_EN,    /**< [GB.GG.D2.TM.TMM.AT] Cpu Reason shape base on packet*/
    CTC_QOS_GLB_CFG_POLICER_HBWP_SHARE_EN,  /**< [GB.GG] HBWP using global share mode*/
    CTC_QOS_GLB_CFG_QUEUE_DROP_MONITOR_EN,  /**< [GG.D2.TM.TMM.AT] Monitoring span on drop,per port enable*/
    CTC_QOS_GLB_CFG_TRUNCATION_LEN,         /**< [GG] The length for packet truncation.*/
    CTC_QOS_GLB_CFG_POLICER_MARK_ECN_EN,    /**< [GG] TCP ECN field will be mark when do policer*/
    CTC_QOS_GLB_CFG_SCH_WRR_EN,             /**< [GG.D2.TM.AT] Schedule WRR mode enable*/
    CTC_QOS_GLB_CFG_TABLE_MAP,              /**< [D2.TM.TMM.AT] QoS table map*/

    CTC_QOS_GLB_CFG_ECN_EN,                 /**< [D2.TM.TMM.AT] Global ecn enable*/
    CTC_QOS_GLB_CFG_SHAPE_PKT_EN,           /**< [D2.TM.AT] Global network port ,group,queue shaping pps enable*/
    CTC_QOS_GLB_CFG_FCDL_INTERVAL,          /**< [D2.TM.TMM.AT] Global fc/pfc deadlock-detect interval time .unit :ms*/
    CTC_QOS_GLB_CFG_POLICER_PORT_STBM_EN,   /**< [D2.TM] Global port policer support stbm mode, if set, port policer will not support other mode*/
    CTC_QOS_GLB_CFG_OOBFC,                  /**< [TM.TMM] Config out of band flow control*/
    CTC_QOS_GLB_CFG_FAST_ECN_THRD,          /**< [TMM] Global threshold for fast ecn, value 0 indicates disable. uint is buffer cell*/
    CTC_QOS_GLB_CFG_FCDL_ACTION,            /**< [TM.TMM.AT] Global fc/pfc deadlock-recover action, value refer to ctc_qos_fcdl_action_t*/
    CTC_QOS_GLB_CFG_ROUND_TRIP_MODE,        /**< [AT] Conifg round trip pool mode, 0:ingress mode, 1:egress mode*/
    CTC_QOS_GLB_CFG_OBM_MAP,                /**< [D2.TM.TMM.AT]  OBM global field map to priority, refer to ctc_qos_obm_map_t*/
    CTC_QOS_GLB_CFG_MAX
};
typedef enum ctc_qos_glb_cfg_type_e ctc_qos_glb_cfg_type_t;

/**
 @brief Qos Phb map type
*/
enum ctc_qos_phb_map_type_e
{
   CTC_QOS_PHB_MAP_PRI,      /**< [GB.GG.D2.TM.TMM.AT] Map priority to phb*/
   CTC_QOS_PHB_MAP_MAX
};
typedef enum ctc_qos_phb_map_type_e ctc_qos_phb_map_type_t;

/**
 @brief Qos Phb map
*/
struct ctc_qos_phb_map_s
{
    uint8 map_type;      /**< [GB.GG.D2.TM.TMM.AT] Map type, refer to ctc_qos_phb_map_type_t*/
    uint8 priority;      /**< [GB.GG.D2.TM.TMM.AT] Qos priority: <0-15>*/
    uint8 cos_index;     /**< [GB.GG.D2.TM.TMM.AT] Regard as cos index */
};
typedef struct ctc_qos_phb_map_s ctc_qos_phb_map_t;

/**
 @brief Qos queue id
*/
struct ctc_qos_queue_id_s
{
    uint8  queue_type; /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue type, refer to ctc_queue_type_t*/
    uint16 queue_id;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue id */
    uint8  class_prio; /**< [AT] Queue class priority to select higher or lower schedule node */

    uint32 gport;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port*/
    uint16 service_id; /**< [GB.D2.TM.TMM.AT] Service identification*/
    uint16 cpu_reason; /**< [GB.GG.D2.TM.TMM.AT] Cpu reason*/
};
typedef struct ctc_qos_queue_id_s ctc_qos_queue_id_t;

/**
 @brief monitor drop configure
*/
struct ctc_qos_queue_drop_monitor_s
{
     uint32 src_gport;      /**< [GG.D2.TM.TMM.AT] The source port of monitor drop, network port */
     uint32 dst_gport;      /**< [GG.D2.TM.TMM.AT] The globally unique destination port of monitor drop, network port */
     uint32 nhid;           /**< [D2.TM.TMM.AT] nexthop id */
     uint8 pri_class_bmp;   /**< [D2.TM.TMM.AT] Priority class bitmap, global config. value 0 indicate all priority class enable for compatible*/
     uint8 enable;          /**< [GG.D2.TM.TMM.AT] Queue drop monitor source port enable*/
     uint8 rate;            /**< [AT] Random queue drop monitor rate,percent:1 / (2^rate)*/
     uint8 rsv[1];
};
typedef struct ctc_qos_queue_drop_monitor_s ctc_qos_queue_drop_monitor_t;

/**
 @brief Policer level select
*/
struct ctc_qos_policer_level_select_s
{
     uint8 ingress_port_level;   /**< [D2.TM.TMM.AT] Ingress port policer level,refer to ctc_qos_policer_level_t (default: 0)*/
     uint8 ingress_vlan_level;   /**< [D2.TM.TMM.AT] Ingress vlan policer level,refer to ctc_qos_policer_level_t (default: 0)*/
     uint8 egress_port_level;    /**< [D2.TM.TMM.AT] Egress port policer level,refer to ctc_qos_policer_level_t (default: 0)*/
     uint8 egress_vlan_level;    /**< [D2.TM.TMM.AT] Egress vlan policer level,refer to ctc_qos_policer_level_t (default: 0)*/
};
typedef struct ctc_qos_policer_level_select_s ctc_qos_policer_level_select_t;

/**
 @brief Qos pfc/fc deadlock-recover action type
*/
enum ctc_qos_fcdl_action_e
{
   CTC_QOS_FCDL_ACTION_TRANSIMIT,  /**< [TM.TMM.AT] Transmit packets in recovery state*/
   CTC_QOS_FCDL_ACTION_DROP,       /**< [TM.TMM.AT] Drop packets in recovery state*/
   CTC_QOS_FCDL_ACTION_MAX
};
typedef enum ctc_qos_fcdl_action_e ctc_qos_fcdl_action_t;

/**
 @brief Qos obm map
*/
/* support key types of ctc_field_key_type_t:
 *********************************************************************************************************
 *              key                        |    desc
 *--------------------------------------------------------------------------------------------------------
 *  l2 key  | CTC_FIELD_KEY_MAC_DA         |    ext_data:mac_addr_t, ext_mask:mac_addr_t, priority is fixed
 *          | CTC_FIELD_KEY_ETHER_TYPE     |    data:uint32, not support mask
 *--------------------------------------------------------------------------------------------------------
 *********************************************************************************************************/
struct ctc_qos_obm_map_s
{
    uint8  field_num;              /**< [TMM.AT] Key Field number */
    ctc_field_key_t  *field_list;  /**< [TMM.AT] Key Field list */

    uint8 priority;                /**< [TMM.AT] OBM priority<0-3>*/
};
typedef struct ctc_qos_obm_map_s ctc_qos_obm_map_t;

/**
 @brief Qos global configure
*/
struct ctc_qos_glb_cfg_s
{
    uint16 cfg_type;                                /**< [GB.GG.D2.TM.TMM.TMA.AT] Config type, refer to ctc_qos_glb_cfg_type_t*/
    uint16 rsv;
    union
    {
        uint32 value;                               /**< [GB.GG.D2.TM.TMM.TMA.AT] Config value*/
        ctc_qos_phb_map_t phb_map;                  /**< [GB.GG.D2.TM.TMM.AT] Phb mapping configure*/
        ctc_qos_queue_drop_monitor_t drop_monitor;  /**< [GG.D2.TMM.AT] Config monitor drop*/
        ctc_qos_table_map_t table_map;              /**< [D2.TM.TMM.TMA.AT] QoS table map*/
        ctc_qos_oobfc_t oobfc;                      /**< [TM.TMM.AT] QoS oobfc configure*/
        ctc_qos_obm_map_t obm_map;                  /**< [TMM.AT] OBM map configure */
    } u;
};
typedef struct ctc_qos_glb_cfg_s ctc_qos_glb_cfg_t;

/**
 @brief Qos internal cn
*/
enum ctc_qos_inter_cn_e
{
    CTC_QOS_INTER_CN_DROP,       /**< [D2.TM.TMM.AT] Responsive wred dropping */
    CTC_QOS_INTER_CN_NON_DROP,   /**< [D2.TM.TMM.AT] Non responsive wred dropping */
    CTC_QOS_INTER_CN_NON_CE,     /**< [D2.TM.TMM.AT] Support ECN and not congestion experienced*/
    CTC_QOS_INTER_CN_CE,         /**< [D2.TM.TMM.AT] Support ECN and congestion experienced */
    CTC_QOS_INTER_CN_MAX
};
typedef enum ctc_qos_inter_cn_e ctc_qos_inter_cn_t;

/**
 @brief Qos drop mode
*/
enum ctc_queue_drop_mode_s
{
    CTC_QUEUE_DROP_WTD,          /**< [GB.GG.D2.TM.TMM.TMA.AT] WTD drop mode */
    CTC_QUEUE_DROP_WRED,         /**< [GB.GG.D2.TM.TMM.TMA.AT] WRED drop mode, for AT: none drop and mark ecn when exceed max threshold */
    CTC_QUEUE_DROP_WRED_NON_ECN, /**< [AT] WRED none ecn drop mode, drop and none mark ecn when exceed max threshold */

    MAX_CTC_QUEUE_DROP
};
typedef enum ctc_queue_drop_mode_s ctc_queue_drop_mode_t;

/**
 @brief Qos queue drop
*/
struct ctc_qos_queue_drop_s
{
    ctc_queue_drop_mode_t mode;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue Drop Mode, type of CTC_QUEUE_DROP_XXX */

    uint32 min_th[CTC_DROP_PREC_NUM];      /**< [GB.D2.TM.TMM.AT] WRED min threshold */
    uint32 max_th[CTC_DROP_PREC_NUM];      /**< [GB.GG.D2.TM.TMM.AT] WRED max threshold, or WTD drop threshold */
    uint16 drop_prob[CTC_DROP_PREC_NUM];   /**< [GB.GG.D2.TM.TMM.AT] WRED max drop probability */
    uint8  is_coexist;                     /**< [D2.TM.TMM.AT] WTD and WRED coexist */
    uint16 ecn_mark_th;                    /**< [GG] If ecn_mark_th equal 0, ecn mark disable. else mean queue ecn mark threshold.
                                                  ecn_mark_th should less than max_th*/
    uint32 ecn_th[CTC_DROP_PREC_NUM];      /**< [D2.TM.TMM.AT] Queue ecn mark threshold.ecn_th should less than max_th*/
    uint32 ecn_th2[CTC_DROP_PREC_NUM];     /**< [AT] ECN mark resume threshold.ecn_th should less than max_th*/
    uint8 drop_factor[CTC_DROP_PREC_NUM];  /**< [D2.TM.TMM.AT] f:0-1/128, 1-1/64, 2-1/32, 3-1/16, 4-1/8, 5-1/4, 6-1/2, 7-1, 8-2, 9-4, 10-8 */
    uint8 is_dynamic;                      /**< [D2.TM.TMM.AT] WTD drop threshold is dynamic*/
    uint8 weight;                          /**< [TMM.AT] EWMA exponent for calculating average count, value 0 for legacy usage.
                                                AvgQueCount(t+1) = AvgQueCount(t) + ((InstQueCount(t+1) - AvgQueCount(t)) / 2 ^ weight)*/
    uint8 rsv[2];
};
typedef struct ctc_qos_queue_drop_s ctc_qos_queue_drop_t;

/**
 @brief Qos queue drop data structure
*/
struct ctc_qos_drop_s
{
    uint8  type;                /**< [D2.TM.TMM.AT] Configure type, refer to ctc_qos_buffer_type_t*/
    uint8  dir;                 /**< [D2.TM.TMM.AT] Direction, refer to ctc_direction_t */
    uint8  non_uc;              /**< [AT] If set indicate for Non-UC traffic*/
    uint32 gport;               /**< [D2.TM.TMM.AT] Global port*/
    uint8  prio_class;          /**< [AT] Priority class <0-7>*/
    uint8  pool;                /**< [AT] Service pool, refer to ctc_qos_igs_resrc_pool_type_t and ctc_qos_egs_resrc_pool_type_t */
    ctc_qos_queue_id_t queue;   /**< [GB.GG.D2.TM.TMM.AT] Generate queue id information*/
    ctc_qos_queue_drop_t drop;  /**< [GB.GG.D2.TM.TMM.TMA.AT] Drop info, refer to ctc_qos_queue_drop_t*/
};
typedef struct ctc_qos_drop_s ctc_qos_drop_t;

/**
 @brief Qos queue stats info
*/
struct ctc_qos_queue_stats_info_s
{
    uint64 deq_packets;     /**< [GB.GG.D2.TM.TMM.AT] De-queue packet number */
    uint64 deq_bytes;       /**< [GB.GG.D2.TM] De-queue packet bytes */
    uint64 drop_packets;    /**< [GB.GG.D2.TM.TMM.AT] Dropped packet number */
    uint64 drop_bytes;      /**< [GB.GG.D2.TM] Dropped packet bytes */
};
typedef struct ctc_qos_queue_stats_info_s ctc_qos_queue_stats_info_t;

/**
 @brief Qos queue stats data structure
*/
struct ctc_qos_queue_stats_s
{
    ctc_qos_queue_id_t queue;           /**< [GB.GG.D2.TM.TMM.AT] Generate queue id information*/
    uint8 stats_en;                     /**< [GB.GG.D2.TM.TMM.AT] enable queue stats, for query&clear, mean bitmap for packet type,
                                                 0 indicate all packet type for legacy usage, bit0 for deq packet, bit1 for drop packet*/

    ctc_qos_queue_stats_info_t stats;   /**< [GB.GG.D2.TM.TMM.AT] Stats parameter*/

    uint16 pp_bmp;                       /**< [AT] Pipeline bitmap */
};
typedef struct ctc_qos_queue_stats_s ctc_qos_queue_stats_t;


/**
 @brief Qos stats type
*/
enum ctc_qos_stats_type_e
{
    CTC_QOS_STATS_TYPE_PRIO_CLASS,   /**< [AT] Priority class stats, refer to ctc_qos_prio_class_stats_t*/
    CTC_QOS_STATS_TYPE_DROP_MONITOR, /**< [AT] Monitoring span on drop stats, refer to ctc_qos_stats_info_t*/
    CTC_QOS_STATS_TYPE_MAX
};
typedef enum ctc_qos_stats_type_e ctc_qos_stats_type_t;

/**
 @brief Qos stats info
*/
struct ctc_qos_stats_info_s
{
    uint64 deq_packets;     /**< [AT] De-queue packet number */
    uint64 drop_packets;    /**< [AT] Dropped packet number */
};
typedef struct ctc_qos_stats_info_s ctc_qos_stats_info_t;
/**
 @brief Qos stats data structure
*/
struct ctc_qos_prio_class_stats_s
{
    uint32 gport;               /**< [AT] Global port */
    uint8 prio_class;           /**< [AT] Priority class <0-7>, value should be priority/2 */

    ctc_qos_stats_info_t stats; /**< [AT] Stats parameter*/
};
typedef struct ctc_qos_prio_class_stats_s ctc_qos_prio_class_stats_t;

/**
 @brief Qos queue packet len adjust data structure
*/
struct ctc_qos_queue_pkt_adjust_s
{
    ctc_qos_queue_id_t queue;     /**< [GB.GG.D2.TM] Generate queue id information*/
    uint8 adjust_len;             /**< [GB.GG.D2.TM] packet length adjust for shaping,
                                               if MSB set, mean minus packet length */
};
typedef struct ctc_qos_queue_pkt_adjust_s ctc_qos_queue_pkt_adjust_t;

/**
 @brief Qos queue type
*/
enum ctc_queue_type_e
{
    CTC_QUEUE_TYPE_SERVICE_INGRESS,     /**< [GB.D2.TM.TMM] Ingress service queue */
    CTC_QUEUE_TYPE_NETWORK_EGRESS,      /**< [GB.GG.D2.TM.TMM.TMA.AT] Egress network queue */
    CTC_QUEUE_TYPE_ILOOP,               /**< [GG.D2.TM.TMM.AT] Ingress loopback queue */
    CTC_QUEUE_TYPE_NORMAL_CPU,          /**< [GB] Normal CPU queue */
    CTC_QUEUE_TYPE_OAM,                 /**< [GB.GG.D2.TM.TMM.AT] OAM queue */
    CTC_QUEUE_TYPE_ELOOP,               /**< [GB.GG.D2.TM.TMM.AT] Egress loopback queue */
    CTC_QUEUE_TYPE_EXCP_CPU,            /**< [GB.GG.D2.TM.TMM.AT] Exception CPU queue */
    CTC_QUEUE_TYPE_FABRIC,              /**< [GB] Fabric queue */
    CTC_QUEUE_TYPE_INTERNAL_PORT,       /**< [GB.GG.D2.TM.TMM.AT] Internal port queue */
    CTC_QUEUE_TYPE_REP,                 /**< [TM.TMM] Replication queue, 0-1 means McLo McHi queue, 2-3 means UcLo UcHi queue*/

    MAX_CTC_QUEUE_TYPE
};
typedef enum ctc_queue_type_e ctc_queue_type_t;

/**
 @brief Qos queue configure type
*/
enum ctc_qos_queue_cfg_type_e
{
    CTC_QOS_QUEUE_CFG_SERVICE_BIND,             /**< [GB.GG.D2.TM.TMM] Service bind information*/
    CTC_QOS_QUEUE_CFG_PRI_MAP,                  /**< [GB.GG.D2.TM.TMM.TMA.AT] Priority to queue select configure*/
    CTC_QOS_QUEUE_CFG_QUEUE_NUM,                /**< [GB.GG] Queue number set for normal queue*/
    CTC_QOS_QUEUE_CFG_QUEUE_REASON_MAP,         /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason mapping queue*/
    CTC_QOS_QUEUE_CFG_QUEUE_REASON_DEST,        /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason set destination*/
    CTC_QOS_QUEUE_CFG_QUEUE_REASON_PRIORITY,    /**< [GB.GG] Cpu reason set priority*/
    CTC_QOS_QUEUE_CFG_QUEUE_REASON_MODE,        /**< [GB] Cpu reason set mode DMA/ETH to cpu*/
    CTC_QOS_QUEUE_CFG_QUEUE_REASON_MISC,        /**< [GG.TMM.AT] Set Cpu reason parameter*/
    CTC_QOS_QUEUE_CFG_QUEUE_STATS_EN,           /**< [GB.GG.D2.TM] Queue stats enale configure*/
    CTC_QOS_QUEUE_CFG_SCHED_WDRR_MTU,           /**< [GB.GG] Schedule wdrr mtu size configure*/
    CTC_QOS_QUEUE_CFG_LENGTH_ADJUST,            /**< [GB.GG.D2.TM] Adjust length for shaping, the length can be negative*/
    CTC_QOS_QUEUE_CFG_FLUSH,                    /**< [D2.TM.TMM.AT] Flush pkt in queue*/
    CTC_QOS_QUEUE_CFG_QUEUE_MAP,                /**< [AT] Queue Map*/
    CTC_QOS_QUEUE_CFG_MAX
};
typedef enum ctc_qos_queue_cfg_type_e ctc_qos_queue_cfg_type_t;

/**
 @brief Qos service id opcode
*/
enum ctc_qos_service_id_opcode_s
{
    CTC_QOS_SERVICE_ID_CREATE            = 0, /**< [GB.D2.TM.TMM] Create service id with queue */
    CTC_QOS_SERVICE_ID_DESTROY           = 1, /**< [GB.D2.TM.TMM] Destroy service id */
    CTC_QOS_SERVICE_ID_BIND_DESTPORT     = 3, /**< [GB.D2.TM.TMM] Service id binding with queue */
    CTC_QOS_SERVICE_ID_UNBIND_DESTPORT   = 4, /**< [GB.D2.TM.TMM] Service id unbinding with queue */
    MAX_CTC_QOS_SERVICE_ID_OPCODE
};
typedef enum ctc_qos_service_id_opcode_s ctc_qos_service_id_opcode_t;

#define CTC_QOS_SERVICE_FLAG_QID_EN    0x00000001
#define CTC_QOS_SERVICE_FLAG_HSCH_EN   0x00000002
#define CTC_QOS_SERVICE_FLAG_OOBFC_EN  0x00000004

/**
 @brief Qos service information
*/
struct ctc_qos_service_info_s
{
    uint8  opcode;           /**< [GB.D2.TM.TMM] ctc_qos_service_id_opcode_t */
    uint16 service_id;       /**< [GB.D2.TM.TMM] Service identifciation*/

    /*bind info*/
    uint16 flag;             /**< [D2.TM.TMM] CTC_QOS_SERVICE_XXX */
    uint8  mode;             /**< [GB.D2.TM.TMM] Service Queue Mode:
                                                 0: follow global service queue mode;
                                                 1: hardware based service_id(TM:1~511, TMM:1~1023);
                                                 2: based logic src port;
                                                 3: based logic dst port when service_queue_mode = 0,
                                                    based nexthop group when service_queue_mode = 1 */
    uint32 gport;             /**< [GB.D2.TM.TMM] Service bind port*/
    uint32 dsnh_offset;       /**< [TM.TMM] Nexthop offset*/
    uint32 dsnh_offset_shift; /**< [TM.TMM] if dsnh_offset set, mean dsnh_offset/logic_port >> dsnh_offset_shift as key to generate queue id.
                                            for TMM, dsnh_offset_shift is global config */
    uint32 logic_port;        /**< [TM.TMM] logic port */
    uint8  dir;               /**< [TM.TMM] Direction, refer to ctc_direction_t */

    uint8  oobfc_offset;      /**< [TM.TMM] Gourp id offset in port and group map for oobfc*/
    uint16 queue_id;          /**< [D2.TM.TMM] user define queue id */
};
typedef struct ctc_qos_service_info_s ctc_qos_service_info_t;

/**
 @brief Qos priority maping
*/
struct ctc_qos_pri_map_s
{
    uint8 priority;             /**< [GB.GG.D2.TM.TMM.TMA.AT] priority <0-15> */
    uint8 color;                /**< [GB.GG.D2.TM.TMM.AT] color 1-red 2-yellow 3-green */
    uint8 non_uc;               /**< [AT] If set indicate for Non-UC traffic*/
    uint8 queue_select;         /**< [GB.GG.D2.TM.TMM.TMA.AT] mapped queue select <0-15>; for D2 TM, mapped queue select <0-7> */
    uint8 drop_precedence;      /**< [GB.GG.D2.TM.TMM.AT] mapped drop precedence <0-3> */
    uint8 rep_queue_select;     /**< [TM.TMM.AT] mapped replication queue select <0-1>, for AT mapped replication queue select <0-5>*/
};
typedef struct ctc_qos_pri_map_s ctc_qos_pri_map_t;

/**
 @brief Qos queue number
*/
struct ctc_qos_queue_number_s
{
    uint8 queue_type;   /**< [GB] Queue type, refer to ctc_queue_type_t*/
    uint8 queue_number; /**< [GB] Queue number binding*/

};
typedef struct ctc_qos_queue_number_s ctc_qos_queue_number_t;

/**
 @brief Qos reason queue map when cpu reason 's destination is local cpu
*/
struct ctc_qos_queue_cpu_reason_map_s
{
    uint16 cpu_reason;     /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason type, refer to ctc_pkt_cpu_reason_t*/
    uint8  reason_group;   /**< [GB.GG.D2.TM.TMM.AT] Cpu reason group */
    uint8  queue_id;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason queue id, 0xff mean enq with priority class*/
    uint8  acl_match_group;/**< [D2.TM.TMM.AT] ACL match group id, 0 means invalid.If reason_group == 0xff, only update acl_match_group.*/
};
typedef struct ctc_qos_queue_cpu_reason_map_s ctc_qos_queue_cpu_reason_map_t;

/**
 @brief Qos reason queue destination
*/
struct ctc_qos_queue_cpu_reason_dest_s
{
    uint16 cpu_reason;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason type, refer to ctc_pkt_cpu_reason_t*/
	uint8  sub_index;       /**< [TMM.AT] cpumac macDa index 0-7, valid when dest_type is CTC_PKT_CPU_REASON_TO_LOCAL_CPU_ETH */
    uint8  dest_type;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason type, refer to ctc_pkt_cpu_reason_dest_t*/
    uint32 dest_port;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Value means enable (dest_port != 0) or disable (dest_port == 0) if dest_type is CTC_PKT_CPU_REASON_DISCARD_CANCEL_TO_CPU,
                                  remote cpu port if dest_type is CTC_PKT_CPU_REASON_TO_REMOTE_CPU */
    uint32 nhid;            /**< [GB.GG.D2.TM.TMM.AT] nhid if dest_type is CTC_PKT_CPU_REASON_TO_NHID */
    uint8 raw_dest_en;      /**< [D2.TM.TMM.AT] If set, The dest_gport in packet header means original forward dest port when dest_type is to-cpu, otherwise, means queue-id */
};
typedef struct ctc_qos_queue_cpu_reason_dest_s ctc_qos_queue_cpu_reason_dest_t;

/**
 @brief Qos reason priority
*/
struct ctc_qos_queue_cpu_reason_priority_s
{
    uint16 cpu_reason;   /**< [GB] Cpu reason type, refer to ctc_pkt_cpu_reason_t */
    uint8 cos;           /**< [GB] Cpu reason cos, will mapping to channel ID for DMA, or cos in CPUMAC header */
    uint8 rsv[1];
};
typedef struct ctc_qos_queue_cpu_reason_priority_s ctc_qos_queue_cpu_reason_priority_t;

/**
 @brief Qos reason
*/
struct ctc_qos_group_cpu_reason_mode_s
{
    uint8 group_type;   /**< [GB] Cpu reason group type, refer to ctc_pkt_cpu_reason_group_type_t */
    uint8 group_id;     /**< [GB] Cpu reason group <0-15>, valid if group_type is CTC_PKT_CPU_REASON_GROUP_EXCEPTION */
    uint8 mode;         /**< [GB] The mode for packet to cpu, refer to ctc_pkt_mode_t */
    uint8 rsv;
};
typedef struct ctc_qos_group_cpu_reason_mode_s ctc_qos_group_cpu_reason_mode_t;

/**
 @brief Qos cpu reason misc configure type
*/
enum ctc_qos_cpu_reason_misc_type_e
{
    CTC_QOS_CPU_REASON_EGRESS_COPP,   /**< [TMM.AT] Egress Control Plane Policing(CoPP) base on reason*/
    CTC_QOS_CPU_REASON_GLOBAL_COPP,   /**< [TMM.AT] Global Control Plane Policing(CoPP) base on reason*/
    CTC_QOS_CPU_REASON_TRUNCATION,    /**< [D2.TM.TMM.AT] Packet will be truncated base on reason*/
    CTC_QOS_CPU_REASON_MAX
};
typedef enum ctc_qos_cpu_reason_misc_type_e ctc_qos_cpu_reason_misc_type_t;

/**
 @brief Qos reason
*/
struct ctc_qos_group_cpu_reason_misc_s
{
    uint16 cpu_reason;       /**< [GG.TMM.AT] Cpu reason type, refer to ctc_pkt_cpu_reason_t */
    uint8 truncation_en;     /**< [GG] Packet will be truncated. The truncation length refer to CTC_QOS_GLB_CFG_TRUNCATION_LEN for GG */
    uint8 type;              /**< [TMM.AT] Config type, refer to ctc_qos_cpu_reason_misc_type_t*/
    uint16 policer_id;       /**< [TMM.AT] policer id, 0:disbale, other:enable*/

    uint16  truncated_len;   /**< [D2.TM.TMM.AT] The length of packet after truncate, value 0 is disable. if value highest bit set, mean truncate profile id.*/
};
typedef struct ctc_qos_group_cpu_reason_misc_s ctc_qos_group_cpu_reason_misc_t;

/**
 @brief Qos queue config structure
*/
struct ctc_qos_queue_com_s
{
    ctc_qos_queue_id_t queue;   /**< [D2.TM.TMM.AT] Generate queue id information*/

    uint32 value;               /**< [D2.TM.TMM.AT] Config value*/
};
typedef struct ctc_qos_queue_com_s ctc_qos_queue_com_t;

/**
@brief Qos queue packet type
*/
enum ctc_qos_queue_pkt_type_e
{
    CTC_QOS_QUEUE_PKT_TYPE_C2C = 0x00000001,       /**< [AT] CPU-to-CPU packet*/
    CTC_QOS_QUEUE_PKT_TYPE_CPU = 0x00000002,       /**< [AT] From CPU or to CPU packet, exclude to remote CPU non-uc packet*/
    CTC_QOS_QUEUE_PKT_TYPE_OAM = 0x00000004,       /**< [AT] OAM packet*/
    CTC_QOS_QUEUE_PKT_TYPE_SPAN = 0x00000008,      /**< [AT] SPAN packet*/
    CTC_QOS_QUEUE_PKT_TYPE_UNKNOWN = 0x00000010,   /**< [AT] Unknown packet */
    CTC_QOS_QUEUE_PKT_TYPE_KNOWN = 0x00000020,     /**< [AT] Known packet */
    CTC_QOS_QUEUE_PKT_TYPE_QDROP = 0x00000040,     /**< [AT] Queue drop monitor, from buffer drop queue */
    CTC_QOS_QUEUE_PKT_TYPE_MAX
};
typedef enum ctc_qos_queue_pkt_type_e ctc_qos_queue_pkt_type_t;

/**
@brief define enq mode
*/
enum ctc_qos_queue_enq_mode_e
{
    CTC_QOS_ENQ_MODE_PRIO_CLASS,      /**< [AT] Enq mode based on priority class, refer to ctc_qos_pri_map_t */
    CTC_QOS_ENQ_MODE_UESER_DEFINE,    /**< [AT] Enqueue mode by user defined */
    CTC_QOS_ENQ_MODE_MAX
};
typedef enum ctc_qos_queue_enq_mode_e ctc_qos_queue_enq_mode_t;
/**
@brief flex queue number config
*/
struct ctc_qos_queue_enq_s
{
    uint32 pkt_type;  /**< [AT] If unset, indicate config queue number,
                                If set, indicate assigned queue_id by packet_type bitmap. Refer to ctc_qos_queue_pkt_type_t*/
    uint8 q_base;     /**< [AT] Queue base */
    uint8 ucq_num;    /**< [AT] Number of unicast queues */
    uint8 mcq_num;    /**< [AT] Number of multicast queues */
    uint8 enq_mode;   /**< [AT] Queue select mode, refer to ctc_qos_queue_enq_mode_t*/
    uint8 class_prio; /**< [AT] Queue class priority to select higher or lower schedule node */
    uint8 sched_mode; /**< [AT] Schedudling priority is strict. refer to ctc_qos_sched_mode_t */
};
typedef struct ctc_qos_queue_enq_s ctc_qos_queue_enq_t;
/**
@brief flex queue map
*/
struct ctc_qos_queue_map_s
{
    ctc_port_bitmap_t port_bmp;   /**< [AT] Port bitmap */
    uint32 gport;                 /**< [AT] Global port */
    uint8 mode;                   /**< [AT] refer to ctc_qos_port_queue_num_t*/
    uint8 enq_num;                /**< [AT] Number of enq_arr*/
    uint8 rsv[2];
    ctc_qos_queue_enq_t* enq;     /**< [AT] Flex queue config */
};
typedef struct ctc_qos_queue_map_s ctc_qos_queue_map_t;
/**
 @brief Qos queue configure
*/
struct ctc_qos_queue_cfg_s
{
    uint8 type;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue configure type, refer to ctc_qos_queue_cfg_type_t*/
    uint8 rsv[3];
    union
    {
        ctc_qos_service_info_t srv_queue_info;            /**< [GB.D2.TM.TMM] Service queue info*/
        ctc_qos_pri_map_t pri_map;                        /**< [GB.GG.D2.TM.TMM.TMA.AT] Priority to queue maping*/
        ctc_qos_queue_number_t queue_num;                 /**< [GB] Queue number config*/
        ctc_qos_queue_cpu_reason_map_t reason_map;        /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason mapping queue*/
        ctc_qos_queue_cpu_reason_dest_t reason_dest;      /**< [GB.GG.D2.TM.TMM.TMA.AT] Cpu reason set destination*/
        ctc_qos_queue_cpu_reason_priority_t reason_pri;   /**< [GB] Cpu reason set priority*/
        ctc_qos_group_cpu_reason_mode_t reason_mode;      /**< [GB] Cpu reason set mode DMA/ETH*/
        ctc_qos_group_cpu_reason_misc_t reason_misc;      /**< [GG.D2.TMM.AT] cpu reason parameter */
        ctc_qos_queue_stats_t stats;                      /**< [GB.GG.D2.TM] Queue stats enable */
        ctc_qos_queue_pkt_adjust_t pkt;                   /**< [GB.GG.D2.TM] Adjust the packet length which equalize the shaping rate*/
        uint32 value_32;                                  /**< [GB.GG] Uint32 value according to ctc_qos_queue_cfg_type_t */
        ctc_qos_queue_com_t cfg;                          /**< [D2.TM.TMM.AT] Queue config, according to ctc_qos_queue_cfg_type_t*/
        ctc_qos_queue_map_t que_map;                      /**< [AT] Queue mapping config*/
    } value;
};
typedef struct ctc_qos_queue_cfg_s ctc_qos_queue_cfg_t;


enum ctc_qos_sched_group_lvl_s
{
    CTC_QOS_SCHED_GROUP_LVL_R,   /**< [TMM] Schedule group level root node*/
    CTC_QOS_SCHED_GROUP_LVL_1,   /**< [TMM] Schedule group level 1 */
    CTC_QOS_SCHED_GROUP_LVL_2,   /**< [TMM] Schedule group level 2 */
    CTC_QOS_SCHED_GROUP_LVL_3,   /**< [TMM] Schedule group level 3 */
    CTC_QOS_SCHED_GROUP_LVL_Q,   /**< [TMM] Schedule group level queue */
    CTC_QOS_SCHED_GROUP_LVL_MAX
};
typedef enum ctc_qos_sched_group_lvl_s ctc_qos_sched_group_lvl_t;

/**
 @brief Qos schedule group id
*/
struct ctc_qos_sched_group_id_s
{
    uint32 group_id;             /**< [TMM] Group id */
    uint8  level;                /**< [TMM] Group level, refer to ctc_qos_sched_group_lvl_t*/
    uint8  rsv0[3];
    ctc_qos_queue_id_t queue;    /**< [TMM] Generate queue id information*/
    uint32 gport;                /**< [TMM] Global port, must be configured when create sched group*/
    uint32 parent_id;            /**< [TMM] Parent group id*/
};
typedef struct ctc_qos_sched_group_id_s ctc_qos_sched_group_id_t;

/**
 @brief Qos shape type
*/
enum ctc_qos_shape_type_e
{
    CTC_QOS_SHAPE_PORT,   /**< [GB.GG.D2.TM.TMM.TMA.AT] Port shaping*/
    CTC_QOS_SHAPE_QUEUE,  /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue shaping*/
    CTC_QOS_SHAPE_GROUP,  /**< [GB.GG.D2.TM.TMM] Group shaping*/
    CTC_QOS_SHAPE_MAX
};
typedef enum ctc_qos_shape_type_e ctc_qos_shape_type_t;

/**
 @brief Qos queue shape
*/
struct ctc_qos_shape_queue_s
{
    ctc_qos_queue_id_t queue; /**< [GB.GG.D2.TM.TMM.TMA.AT] Generate queue id information*/

    uint8  enable;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue shaping enable*/
    uint8  pps_en;            /**< [TMM.TMA] Queue shape PPS mode enable*/
    uint16  rsv0;

    uint32  pir;              /**< [GB.GG.D2.TM.TMM.TMA.AT] Max rate, Peak Information Rate (unit :kbps/pps)*/

    uint32  pbs;              /**< [GB.GG.D2.TM.TMM.TMA.AT] Peak Burst Size, (unit :kb/pkt).
                                       if set CTC_QOS_SHP_TOKE_THRD_DEFAULT, default value will be set */

    uint32  cir;              /**< [GB.GG.D2.TM.TMM.TMA.AT] Committed Information Rate (unit :kbps/pps).
                                       CIR = 0 is CIR Fail; cir = CTC_MAX_UINT32_VALUE is CIR pass*/
    uint32  cbs;              /**< [GB.GG.D2.TM.TMM.TMA.AT] Committed Burst Size, (unit :kb/pkt),
                                       if set CTC_QOS_SHP_TOKE_THRD_DEFAULT, default value will be set */

};
typedef struct ctc_qos_shape_queue_s ctc_qos_shape_queue_t;

/**
 @brief Qos group shape
*/
struct ctc_qos_shape_group_s
{
    uint16 service_id;          /**< [GB] Service identification*/
    uint8  group_type;          /**< [GB]group type, refer to ctc_qos_sched_group_type_t*/
    uint32 gport;               /**< [GB.GG] Dest Port*/
    ctc_qos_queue_id_t queue;   /**< [GB.GG.D2.TM.TMM] Generate queue id information*/

    uint32 group_id;            /**< [TMM] Group id*/
    uint8  class_prio_valid;    /**< [TMM] Class priority valid */
    uint8  class_prio;          /**< [TMM] Class priority*/
    uint8  enable;              /**< [GB.GG.D2.TM.TMM] Group shaping enable*/
    uint8  pps_en;              /**< [TMM] Group shape PPS mode enable*/
    uint8  rsv0;
    uint32  pir;                /**< [GB.GG.D2.TM.TMM] group shaping commit rate,(unit :kbps/pps)*/
    uint32  pbs;                /**< [GB.GG.D2.TM.TMM] group shaping bucket size,(unit :kb/pkt),
                                         if set CTC_QOS_SHP_TOKE_THRD_DEFAULT,  default value will be set*/

    uint32  cir;                /**< [TMM] Committed Information Rate (unit :kbps/pps)*/
    uint32  cbs;                /**< [TMM] Committed Burst Size (unit :kb/pkt)*/
};
typedef struct ctc_qos_shape_group_s ctc_qos_shape_group_t;

/**
 @brief Qos port shape
*/
struct ctc_qos_shape_port_s
{
    uint32 gport;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port*/
    uint8  enable;          /**< [GB.GG.D2.TM.TMM.TMA.AT] Port shaping enable*/
    uint8  sub_dest_id;     /**< [GG] only valid for local cpu port, range <0-3> */
    uint8  pps_en;          /**< [TM.TMM.TMA.AT] Port shape PPS mode enable, AT: if pir = CTC_MAX_UINT32_VALUE, indicate shape base on packet, else is invalid*/
    uint8  rsv;

    uint32  pir;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Peak Information Rate, (unit :kbps/pps)*/
    uint32  pbs;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Peak Burst Size,(unit :kb/pkt),
                                     if set CTC_QOS_SHP_TOKE_THRD_DEFAULT, default value will be set */
    uint32  ecn_mark_rate;  /*[GG.TM.TMM.AT] ECN will be marked when output port rate reach ecn_mark_rate, (unit :kbps)*/

};
typedef struct ctc_qos_shape_port_s ctc_qos_shape_port_t;

/**
 @brief Qos shape data structure
*/
struct ctc_qos_shape_s
{
    uint8 type;        /**< [GB.GG.D2.TM.TMM.TMA.AT] Shaping type, refer to ctc_qos_shape_type_t*/
    uint8 rsv0[3];

    union
    {
        ctc_qos_shape_queue_t queue_shape; /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue shaping*/
        ctc_qos_shape_group_t group_shape; /**< [GB.GG.D2.TM.TMM] Group shaping*/
        ctc_qos_shape_port_t port_shape;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Port shaping*/
    } shape;
};
typedef struct ctc_qos_shape_s ctc_qos_shape_t;

/**
 @brief Qos schedule type
*/
enum ctc_qos_sched_type_e
{
    CTC_QOS_SCHED_QUEUE,        /**< [GB.GG.D2.TM.TMM.AT] Queue level schedule*/
    CTC_QOS_SCHED_GROUP,        /**< [GB.GG.D2.TM.TMM.AT] Group level schedule*/
    CTC_QOS_SCHED_MAX
};
typedef enum ctc_qos_sched_type_e ctc_qos_sched_type_t;

/**
 @brief Qos schedule group type
*/
enum ctc_qos_sched_group_type_e
{
    CTC_QOS_SCHED_GROUP_PORT,       /**< [GB] Schedule is port group*/
    CTC_QOS_SCHED_GROUP_SERVICE,    /**< [GB] Schedule is service group*/
    CTC_QOS_SCHED_GROUP_MAX
};
typedef enum ctc_qos_sched_group_type_e ctc_qos_sched_group_type_t;

/**
 @brief Qos schedule configure type
*/
enum ctc_qos_sched_cfg_type_e
{
    CTC_QOS_SCHED_CFG_CONFIRM_WEIGHT,   /**< [GB.GG.D2.TM.TMM.AT] Confirm (green color) weight*/
    CTC_QOS_SCHED_CFG_EXCEED_WEIGHT,    /**< [GB.GG.D2.TM.TMM.TMA.AT] Exceed (yellow color) weight*/
    CTC_QOS_SCHED_CFG_CONFIRM_CLASS,    /**< [GB.GG.D2.TM.TMM.AT] Confirm (green color) class*/
    CTC_QOS_SCHED_CFG_EXCEED_CLASS,     /**< [GB.GG.D2.TM.TMM.TMA.AT] Exceed (yellow color) class*/
    CTC_QOS_SCHED_CFG_SUB_GROUP_ID,     /**< [D2.TM.TMM] Add queue class to sub group*/
    CTC_QOS_SCHED_CFG_SUB_GROUP_WEIGHT, /**< [D2.TM.TMM] Sub group weight */
    CTC_QOS_SCHED_CFG_GROUP_PARENT_ID,  /**< [TMM] Schedule group parent group id*/
    CTC_QOS_SCHED_CFG_GROUP_SCH_MODE,   /**< [AT] Schedule group mode*/

    CTC_QOS_SCHED_CFG_MAX
};
typedef enum ctc_qos_sched_cfg_type_e ctc_qos_sched_cfg_type_t;

/**
 @brief Qos schedule mode
*/
enum ctc_qos_sched_mode_e
{
    CTC_QOS_SCHED_MODE_SP,     /**< [AT] Strict priority Scheduling*/
    CTC_QOS_SCHED_MODE_WDRR,   /**< [AT] Deficit Weighted Round-Robin Scheduling*/
    CTC_QOS_SCHED_MODE_MAX
};
typedef enum ctc_qos_sched_mode_e ctc_qos_sched_mode_t;


/**
 @brief Qos queue level schedule
*/
struct ctc_qos_sched_queue_s
{
    uint8  cfg_type;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Configure type, refer to ctc_qos_sched_cfg_type_t */

    ctc_qos_queue_id_t queue;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Generate queue id information*/

    uint16 confirm_weight;      /**< [GB] Comfirmed weight for green packet*/
    uint16 exceed_weight;       /**< [GB.GG.D2.TM.TMM.TMA.AT] Exceeded  weight for yellow packet*/

    uint8 confirm_class;        /**< [GB.GG] queue class for green packet */
    uint8 exceed_class;         /**< [GB.GG.D2.TM.TMM.TMA.AT] queue class for yellow packet */
};
typedef struct ctc_qos_sched_queue_s ctc_qos_sched_queue_t;

/**
 @brief Qos group level schedule
*/
struct ctc_qos_sched_group_s
{
    uint32 gport;               /**< [GB] Global port(input)*/
    uint16 service_id;          /**< [GB] Service identifaication(input)*/
    uint8 group_type;           /**< [GB.TMM.AT]GB:Scheudle type, refer to ctc_qos_sched_group_type_t.
                                                from TMM:0 indicate group configuration, 1 indicate group node (class priority) configuration*/
    uint8 cfg_type;             /**< [GB.GG.D2.TM.TMM.AT]Configure type, refer to ctc_qos_sched_cfg_type_t*/

    ctc_qos_queue_id_t queue;   /**< [GB.GG.D2.TM.TMM.AT] Generate queue id information*/
    uint32  group_id;           /**< [TMM] Group id*/
    uint32* child_id_list;      /**< [TMM] Child group id list*/
    uint16  child_cnt;          /**< [TMM] Child group id count, the caller should set child_cnt, if child_cnt
                                           is not equal to the actual cnt, the callee will return the actual cnt*/
    uint32  parent_id;          /**< [TMM] Parent group id*/


    uint8 queue_class;          /**< [GB.GG.D2.TM.TMM] Queue class include confirm class and exceed class,
                                                       from TMM:only valid when cfg_type is CTC_QOS_SCHED_CFG_SUB_GROUP_ID
                                                       or CTC_QOS_SCHED_CFG_SUB_GROUP_WEIGHT,
                                                       for Replication queue, queue class is 0-3, 0 means Mc class, 1-2 means UcLo UcHi class */
    uint8 class_priority;       /**< [GB.GG.D2.TM.TMM.AT] Class priority*/

    uint8 weight;               /**< [GB.GG.D2.TM.TMM.AT] Schedule weight*/
    uint8 sub_group_id;         /**< [D2.TM.TMM] Sub group id, from TMM:only valid when cfg_type is CTC_QOS_SCHED_CFG_SUB_GROUP_ID
                                                 or CTC_QOS_SCHED_CFG_SUB_GROUP_WEIGHT */
    uint8 mode;                 /**< [AT] Scheudle mode, refer to ctc_qos_sched_mode_t */
};
typedef struct ctc_qos_sched_group_s ctc_qos_sched_group_t;

/**
 @brief Qos schedule data structure
*/
struct ctc_qos_sched_s
{
    uint8 type;         /**< [GB.GG.D2.TM.TMM.AT] Scheudle type, refer to ctc_qos_sched_type_t */
    uint8 rsv0[3];

    union
    {
        ctc_qos_sched_queue_t queue_sched;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Queue level schedule*/
        ctc_qos_sched_group_t group_sched;   /**< [GB.GG.D2.TM.TMM.AT] Group level schedule*/
    } sched;
};
typedef struct ctc_qos_sched_s ctc_qos_sched_t;

/**
 @brief Qos ingress resource pools type
*/
enum ctc_qos_igs_resrc_pool_type_e
{
    CTC_QOS_IGS_RESRC_DEFAULT_POOL    = 0,     /**< [GB.GG.D2.TM.TMM] Default pool */
    CTC_QOS_IGS_RESRC_NON_DROP_POOL   = 1,     /**< [GB.GG.D2.TM.TMM] Non-drop pool */
    CTC_QOS_IGS_RESRC_SPAN_POOL       = 2,     /**< [TMM] SPAN and mcast pool*/
    CTC_QOS_IGS_RESRC_MIN_POOL        = 4,     /**< [GB.GG.D2.TM.TMM.AT] Min guarantee pool */
    CTC_QOS_IGS_RESRC_C2C_POOL        = 5,     /**< [GB.GG.D2.TM.TMM.AT] CPU to CPU pool */
    CTC_QOS_IGS_RESRC_CONTROL_POOL    = 6,     /**< [GB.GG.D2.TM.TMM.AT] Control pool, from cpu or to cpu */
    CTC_QOS_IGS_RESRC_ROUND_TRIP_POOL = 7,     /**< [GG.AT] Round trip pool */
    CTC_QOS_IGS_RESRC_SC0_POOL        = 0,     /**< [AT] Service0 pool */
    CTC_QOS_IGS_RESRC_SC1_POOL        = 1,     /**< [AT] Service1 pool */
    CTC_QOS_IGS_RESRC_SC2_POOL        = 2,     /**< [AT] Service2 pool */
    CTC_QOS_IGS_RESRC_SC3_POOL        = 3,     /**< [AT] Service3 pool */

    CTC_QOS_IGS_RESRC_POOL_MAX        = 8
};
typedef enum ctc_qos_igs_resrc_pool_type_e ctc_qos_igs_resrc_pool_type_t;

/**
 @brief Qos egress resource pools type
*/
enum ctc_qos_egs_resrc_pool_type_e
{
    CTC_QOS_EGS_RESRC_DEFAULT_POOL    = 0,     /**< [GB.GG.D2.TM.TMM] Default pool, support congest level */
    CTC_QOS_EGS_RESRC_NON_DROP_POOL   = 1,     /**< [GB.GG.D2.TM.TMM] Non-drop pool */
    CTC_QOS_EGS_RESRC_SPAN_POOL       = 2,     /**< [GG.D2.TM.TMM] SPAN and mcast pool, support congest level */
    CTC_QOS_EGS_RESRC_CONTROL_POOL    = 3,     /**< [GB.GG.D2.TM.TMM] Control pool, from cpu or to cpu */
    CTC_QOS_EGS_RESRC_MIN_POOL        = 4,     /**< [GB.GG.D2.TM.TMM.AT] Min guarantee pool */
    CTC_QOS_EGS_RESRC_C2C_POOL        = 5,     /**< [GB.GG.D2.TM.TMM.AT] CPU to CPU pool */
    CTC_QOS_EGS_RESRC_SC0_POOL        = 0,     /**< [AT] Service0 pool */
    CTC_QOS_EGS_RESRC_SC1_POOL        = 1,     /**< [AT] Service1 pool */
    CTC_QOS_EGS_RESRC_SC2_POOL        = 2,     /**< [AT] Service2 pool */
    CTC_QOS_EGS_RESRC_SC3_POOL        = 3,     /**< [AT] Service3 pool */

    CTC_QOS_EGS_RESRC_POOL_MAX        = 6
};
typedef enum ctc_qos_egs_resrc_pool_type_e ctc_qos_egs_resrc_pool_type_t;

/**
 @brief Qos resource configure type
*/
enum ctc_qos_resrc_cfg_type_e
{
    CTC_QOS_RESRC_CFG_POOL_CLASSIFY,        /**< [GB.GG.D2.TM.TMM.AT] Priority => pool */
    CTC_QOS_RESRC_CFG_PORT_MIN,             /**< [GB.GG.D2.TM.TMM.TMA.AT] Port min guarantee threshold */
    CTC_QOS_RESRC_CFG_QUEUE_DROP,           /**< [GB.GG] Config queue drop profile */
    CTC_QOS_RESRC_CFG_FLOW_CTL,             /**< [GB.GG.D2.TM.TMM.TMA.AT] Config queue flow control threshold */
    CTC_QOS_RESRC_CFG_FCDL_DETECT,          /**< [D2.TM.TMM.AT] Config queue flow control deadlock-detect*/
    CTC_QOS_RESRC_CFG_QUEUE_MIN,            /**< [D2.TM.TMM.AT] Queue min guarantee threshold */
    CTC_QOS_RESRC_CFG_OBM_POOL,             /**< [D2.TM.TMM.AT] OBM(Oversubscription Buffer Module) resrc threshold */
    CTC_QOS_RESRC_CFG_MAX
};
typedef enum ctc_qos_resrc_cfg_type_e ctc_qos_resrc_cfg_type_t;

/**
 @brief Qos resource classify pool
*/
struct ctc_qos_resrc_classify_pool_s
{
    uint32 gport;               /**< [GB.GG.D2.TM.TMM.AT] Global port */
    ctc_qos_queue_id_t queue;   /**< [AT] Generate queue id information*/
    uint8  priority;            /**< [GB.GG.D2.TM.TMM.AT] Qos priority: <0-15>*/
    uint8  dir;                 /**< [GB.GG.D2.TM.TMM.AT] Direction, refer to ctc_direction_t */
    uint8  non_uc;              /**< [AT] If set indicate for Non-UC traffic*/

    uint8  pool;                /**< [GB.GG.D2.TM.TMM.AT] refer to ctc_qos_igs_resrc_pool_type_t and ctc_qos_egs_resrc_pool_type_t */
};
typedef struct ctc_qos_resrc_classify_pool_s ctc_qos_resrc_classify_pool_t;

/**
 @brief Qos resource port min guarante threshold config
*/
struct ctc_qos_resrc_port_min_s
{
    uint32 gport;               /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port */
    uint8  dir;                 /**< [GB.GG.D2.TM.TMM.TMA.AT] Direction, refer to ctc_direction_t */
    uint8  non_uc;              /**< [AT] If set indicate for Non-UC traffic*/
    uint8  prio_class_en;       /**< [TMM.AT] Priority class enable, 0: disable, 1: priority class, 2: service pool */
    uint8  prio_class;          /**< [TMM.AT] Priority class <0-7>, value should be priority/2, if prio_class_en is 2,
                                              it reused as servie pool, refer to ctc_qos_igs_resrc_pool_type_t and ctc_qos_egs_resrc_pool_type_t*/

    uint16 threshold;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Port min guarantee threshold, uint is buffer cell <0-255> */
};
typedef struct ctc_qos_resrc_port_min_s ctc_qos_resrc_port_min_t;

struct ctc_qos_resrc_queue_min_s
{
    ctc_qos_queue_id_t queue;   /**< [D2.TM.TMM.AT] Generate queue id information*/
    uint16 threshold;           /**< [D2.TM.TMM.AT] queue min guarantee threshold, uint is buffer cell */
};
typedef struct ctc_qos_resrc_queue_min_s ctc_qos_resrc_queue_min_t;

enum ctc_qos_resrc_fc_type_e
{
    CTC_QOS_FC_TYPE_NORMAL,          /**< [AT] Normal flow control*/
    CTC_QOS_FC_TYPE_MAX
};
typedef enum ctc_qos_resrc_fc_type_e ctc_qos_resrc_fc_type_t;

struct ctc_qos_resrc_fc_s
{
    uint8 type;                 /**< [AT] FC type, refer to ctc_qos_resrc_fc_type_t */

    uint32 gport;               /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port */
    uint8  priority_class;      /**< [GB.GG.D2.TM.TMM.AT] Pfc priority class <0-7>, value should be priority/8, for D2 TM, value should be priority/2 */
    uint8 is_pfc;               /**< [GB.GG.D2.TM.TMM.AT] Is pfc */
    uint8 is_oobfc;             /**< [TM.TMM] If set, Indicate out of band flow control */
    uint32 xon_thrd;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Xon threshold which triger send xon pause frame */
    uint32 xoff_thrd;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Xoff threshold which triger send xoff pause frame */
    uint32 drop_thrd;           /**< [GB.GG.D2.TM.TMM.TMA.AT] Drop threshold which packet will be drop  */
};
typedef struct ctc_qos_resrc_fc_s ctc_qos_resrc_fc_t;

/**
 @brief Qos pfc/fc deadlock state type
*/
enum ctc_qos_fcdl_state_type_e
{
    CTC_QOS_FCDL_STATE_NONE,          /**< [D2.TM.TMM.AT] None */
    CTC_QOS_FCDL_STATE_DEADLOCK,      /**< [D2.TM.TMM.AT] Deadlock detected */
    CTC_QOS_FCDL_STATE_RECOVER_DONE,  /**< [TM.TMM.AT] Deadlock recover done */
    CTC_QOS_FCDL_STATE_MAX
};
typedef enum ctc_qos_fcdl_state_type_e ctc_qos_fcdl_state_type_t;

struct ctc_qos_fcdl_event_s
{
    uint32 gport;                             /**< [D2.TM.TMM.AT] Global port */
    uint8  state[CTC_MAX_FCDL_DETECT_NUM];    /**< [D2.TM.TMM.AT] Flowctl deadlock state, refer to ctc_qos_fcdl_state_type_t*/
    uint8  pri_class[CTC_MAX_FCDL_DETECT_NUM];/**< [D2.TM.TMM.AT] Pfc deadlock priority class*/
};
typedef struct ctc_qos_fcdl_event_s ctc_qos_fcdl_event_t;

struct ctc_qos_resrc_fcdl_detect_s
{
    uint32 gport;                                  /**< [D2.TM.TMM.AT] Global port */
    uint8  priority_class[CTC_MAX_FCDL_DETECT_NUM];/**< [D2.TM.TMM.AT] Pfc deadlock-detect  priority class, value should be priority/2*/
    uint8  enable;                                 /**< [D2.TM.TMM.AT] Pfc/fc deadlock-detect  enable*/
    uint8  valid_num;                              /**< [D2.TM.TMM.AT] Valid num for priority_class*/
    uint8  detect_mult;                            /**< [D2.TM.TMM.AT] Pfc/fc deadlock-detect multiplier */
    uint8  mode;                                   /**< [TM.TMM.AT] Pfc/fc deadlock-recover mode, 0: detect only, 1: detect & disable flowctl,
                                                                  2:detect & disable flowctl & enable flowctl again when time expired*/
    uint32 timeout;                                /**< [TM.TMM.AT] Pfc/fc deadlock-recover time, will enable flowctl when time expired.
                                                                  only valid when mode is 2(unit:ms)*/
};
typedef struct ctc_qos_resrc_fcdl_detect_s ctc_qos_resrc_fcdl_detect_t;

/**
 @brief Qos obm resource pools type
*/
enum ctc_qos_obm_resrc_pool_type_e
{
    CTC_QOS_OBM_RESRC_POOL_LOSSY0,      /**< [D2.TM.TMM.AT] Lossy0 pool */
    CTC_QOS_OBM_RESRC_POOL_LOSSY1,      /**< [D2.TM.TMM.AT] Lossy1 pool */
    CTC_QOS_OBM_RESRC_POOL_LOSSLESS0,   /**< [D2.TM.TMM.AT] Lossless0 pool*/
    CTC_QOS_OBM_RESRC_POOL_LOSSLESS1,   /**< [D2.TM.TMM.AT] Lossless1 pool */

    CTC_QOS_OBM_RESRC_POOL_MAX
};
typedef enum ctc_qos_obm_resrc_pool_type_e ctc_qos_obm_resrc_pool_type_t;

/**
 @brief  qos obm resrc init config
*/
struct ctc_qos_obm_resrc_pool_s
{
    uint8  index;                                   /**< [D2.TM.TMM.AT] obm resrc index<0-4>,for TMM index support <0-7>, for arctic index support <0-31> */
    uint16 pool_thrd[CTC_QOS_OBM_RESRC_POOL_MAX];   /**< [D2.TM.TMM.AT] Assign obm pools size*/
    uint16 xon_thrd;                                /**< [D2.TM.TMM.AT] Xon threshold which triger send xon pause frame */
    uint16 xoff_thrd;                               /**< [D2.TM.TMM.AT] Xoff threshold which triger send xoff pause frame */
};
typedef struct ctc_qos_obm_resrc_pool_s ctc_qos_obm_resrc_pool_t;

typedef ctc_qos_drop_t  ctc_qos_drop_array[CTC_RESRC_MAX_CONGEST_LEVEL_NUM];
/**
 @brief Qos resource mangement data structure
*/
struct ctc_qos_resrc_s
{
    uint8  cfg_type;            /**< [GB.GG.D2.TM.TMM.TMA.AT] Configure type, refer to ctc_qos_resrc_cfg_type_t*/

    union
    {
        ctc_qos_resrc_classify_pool_t pool;     /**< [GB.GG.D2.TM.TMM.AT] classify pool */
        ctc_qos_resrc_port_min_t port_min;      /**< [GB.GG.D2.TM.TMM.TMA.AT] set ingress/egress port guarantee min threshold */
        ctc_qos_resrc_queue_min_t queue_min;    /**< [D2.TM.TMM.AT] set queue guarantee min threshold */
        ctc_qos_drop_array queue_drop;          /**< [GB.GG] set queue drop of 8 congest level */
        ctc_qos_resrc_fc_t flow_ctl;            /**< [GB.GG.D2.TM.TMM.TMA.AT] set flow Control resource threshold */
        ctc_qos_resrc_fcdl_detect_t fcdl_detect;/**< [D2.TM.TMM.AT] set flow Control deadlock-detect */
        ctc_qos_obm_resrc_pool_t obm_pool;      /**< [D2.TM.TMM.AT] obm resource pool threshold*/
    }u;
};
typedef struct ctc_qos_resrc_s ctc_qos_resrc_t;

/**
 @brief Qos resource pool stats type
*/
enum ctc_qos_resrc_pool_stats_type_e
{
    CTC_QOS_RESRC_STATS_IGS_POOL_COUNT,         /**< [GB.GG.D2.TM.TMM.AT] ingress pool instant or snapshot count */
    CTC_QOS_RESRC_STATS_IGS_TOTAL_COUNT,        /**< [GB.GG.D2.TM.TMM.TMA.AT] ingress total instant count */
    CTC_QOS_RESRC_STATS_IGS_PORT_COUNT,         /**< [D2.TM.TMM.TMA.AT] ingress port instant count */
    CTC_QOS_RESRC_STATS_EGS_POOL_COUNT,         /**< [GB.GG.D2.TM.TMM.AT] egress pool instant or snapshot count */
    CTC_QOS_RESRC_STATS_EGS_TOTAL_COUNT,        /**< [GB.GG.D2.TM.TMM.TMA.AT] egress total instant count */
    CTC_QOS_RESRC_STATS_EGS_PORT_COUNT,         /**< [D2.TM.TMM.TMA.AT] egress port instant or snapshot count */
    CTC_QOS_RESRC_STATS_QUEUE_COUNT,            /**< [GB.GG.D2.TM.TMM.TMA.AT] queue instant or snapshot ount */
    CTC_QOS_RESRC_STATS_PRI_CLASS_COUNT,        /**< [D2.TM.TMM.AT] priority class instant count*/
    CTC_QOS_RESRC_STATS_IGS_PORT_SC_COUNT,      /**< [D2.TM.TMM.AT] ingress port use service pool instant count*/
    CTC_QOS_RESRC_STATS_EGS_PORT_SC_COUNT,      /**< [D2.TM.TMM.AT] egress port use service pool instant count*/

    CTC_QOS_RESRC_STATS_COUNT_MAX
};
typedef enum ctc_qos_resrc_pool_stats_type_e ctc_qos_resrc_pool_stats_type_t;

/**
 @brief Qos resource pool stats
*/
struct ctc_qos_resrc_pool_stats_s
{
    uint8 type;                 /**< [GB.GG.D2.TM.TMM.TMA.AT] stats type, refer to ctc_qos_resrc_pool_stats_type_t */
    uint8 pp_id;                /**< [AT] Pipeline id, care pipeline id */
    uint8 rsv[2];

    ctc_qos_queue_id_t queue;   /**< [GB.GG.D2.TM.TMM.TMA.AT] Generate queue id information*/
    uint32 gport;               /**< [GB.GG.D2.TM.TMM.TMA.AT] Global port */
    uint8  priority;            /**< [GB.GG.D2.TM.TMM] Qos priority: <0-15> */
    uint8  pool;                /**< [GB.GG.D2.TM.TMM.AT] refer to ctc_qos_igs_resrc_pool_type_t and ctc_qos_egs_resrc_pool_type_t */
    uint8  non_uc;              /**< [AT] If set indicate for Non-UC traffic*/
    uint8  pri_class;           /**< [TMM.AT] Priority class <0-7>, value should be priority/2 */

    uint32 count;               /**< [GB.GG.D2.TM.TMM.TMA.AT] instant count */
};
typedef struct ctc_qos_resrc_pool_stats_s ctc_qos_resrc_pool_stats_t;

/**
 @brief Qos resource mangement drop profile
*/
struct ctc_qos_resrc_drop_profile_s
{
    uint8  congest_level_num;                                          /**< [GB.GG] congest level num <1-8> */
    uint16 congest_threshold[CTC_RESRC_MAX_CONGEST_LEVEL_THRD_NUM];    /**< [GB.GG] congest threshold for different level */
    ctc_qos_queue_drop_t queue_drop[CTC_RESRC_MAX_CONGEST_LEVEL_NUM];  /**< [GB.GG] queue threshold for different level */
};
typedef struct ctc_qos_resrc_drop_profile_s ctc_qos_resrc_drop_profile_t;

/**
 @brief Qos resource profile
*/
enum ctc_qos_resrc_pool_mode_e
{
    CTC_QOS_RESRC_POOL_DISABLE,          /**< [GB.GG.D2.TM.TMM.TMA.AT] Disable resource managent. For ingress only have default pool; for egress, have default and control pool */
    CTC_QOS_RESRC_POOL_MODE1,            /**< [GB.GG.D2.TM.TMM.TMA] disable span and non-drop pool */
    CTC_QOS_RESRC_POOL_MODE2,            /**< [GB.GG.D2.TM.TMM] all pool used, and some pool map is done */
    CTC_QOS_RESRC_POOL_USER_DEFINE,      /**< [GB.GG.D2.TM.TMM.AT] User define mode */

    CTC_QOS_RESRC_POOL_MODE_MAX
};
typedef enum ctc_qos_resrc_pool_mode_e ctc_qos_resrc_pool_mode_t;

/**
 @brief  qos resrc init config
*/
struct ctc_qos_resrc_pool_cfg_s
{
    uint32 igs_pool_size[CTC_QOS_IGS_RESRC_POOL_MAX];   /**< [GB.GG.D2.TM.TMM.AT] Assign igs pools size, for user define (default: 0,0,0,0,0,0,0)*/
    uint32 egs_pool_size[CTC_QOS_EGS_RESRC_POOL_MAX];   /**< [GB.GG.D2.TM.TMM.AT] Assign egs pools size, for user define (default: 0,0,0,0,0,0)*/
    uint8  igs_pool_mode;                   /**< [GB.GG.D2.TM.TMM.TMA.AT] Select resource profile, refert to ctc_qos_resrc_pool_mode_t (default: 0)*/
    uint8  egs_pool_mode;                   /**< [GB.GG.D2.TM.TMM.AT] Select resource profile, refert to ctc_qos_resrc_pool_mode_t (default: 0)*/
    ctc_qos_resrc_drop_profile_t drop_profile[CTC_QOS_EGS_RESRC_POOL_MAX];  /**< [GB.GG]  Only default|non-drop|span|control pool support drop profile*/
};
typedef struct ctc_qos_resrc_pool_cfg_s ctc_qos_resrc_pool_cfg_t;

/**
 @brief  qos resrc init config
*/
enum ctc_qos_port_queue_num_e
{

    CTC_QOS_PORT_QUEUE_NUM_8,            /**< [GG.D2.TM.TMM] D2&TM&TMM:queue mode 0:8(basic) + 1(cpu)*/
    CTC_QOS_PORT_QUEUE_FIXED_MODE = 0,   /**< [AT] fixed 12 queue num, 8(basic UCQ)+1(span MCQ)+1(mcast MCQ)+1(c2c UCQ)+1(c2c MCQ)**/
    CTC_QOS_PORT_QUEUE_NUM_16,           /**< [GG.D2.TM.TMM] D2:queue mode 1:8(basic) + 1(span) + 4(mcast)
                                                             TM&TMM:queue mode 1:8(basic) + 1(cpu) + 1(span) + 1(mcast)*/
    CTC_QOS_PORT_QUEUE_NUM_4_BPE,        /**< [GG] 4 queue mode for 480 port extender, must configurate by BPE before use*/
    CTC_QOS_PORT_QUEUE_NUM_8_BPE,        /**< [GG] 8 queue mode for 240 port extender, must configurate by BPE before use*/

    CTC_QOS_PORT_QUEUE_NUM_16_2,         /**< [TM.TMM] mean queue mode 2:8(uc&mc) + 1(span) + 1(cpu)*/
    CTC_QOS_PORT_QUEUE_FLEX_MODE,        /**< [AT] flexable queue mode  */

    MAX_CTC_PORT_QUEUE_NUM_MAX
};
typedef enum ctc_qos_port_queue_num_e ctc_qos_port_queue_num_t;

/**
@brief defeines svc policer resource  mode
*/
enum ctc_qos_policer_svc_mode_flag_e
{
    CTC_QOS_POLICER_SVC_MODE_FID_STORMCTL   = 0x00000001,   /**< [TMM.AT] Svc Policer used for Fid Storm Ctl, if set, it will waste once policer level and can not use other mode */
    CTC_QOS_POLICER_SVC_MODE_VLAN_STORMCTL  = 0x00000002,   /**< [AT] Svc Policer used for VLAN Storm Ctl, if set, can not use other mode */
    CTC_QOS_POLICER_SVC_MODE_PORT_POLICER   = 0x00000004,   /**< [AT] Svc Policer used for Port Policer, coexist with other policer mode and SVC Policer self */
    CTC_QOS_POLICER_SVC_MODE_VLAN_POLICER   = 0x00000008,   /**< [AT] Svc Policer used for Vlan Policer, coexist with other policer mode and SVC Policer self */
};
typedef enum ctc_qos_policer_svc_mode_flag_e ctc_qos_policer_svc_mode_flag_t;

/**
 @brief  qos global policer num
*/
struct  ctc_qos_glb_policer_num_s
{
    uint16 igs_level0;    /**< [AT] Ingress policer level 0 global policer num*/
    uint16 igs_level1;    /**< [AT] Ingress policer level 1 global policer num*/
    uint16 egs_level0;    /**< [AT] egress policer level 0 global policer num*/
    uint16 egs_level1;    /**< [AT] egress policer level 1 global policer num*/
};
typedef struct ctc_qos_glb_policer_num_s ctc_qos_glb_policer_num_t;

/**
 @brief  qos global config
*/
struct ctc_qos_global_cfg_s
{
    uint8  queue_num_per_network_port;      /**< [GB.GG.D2.TM.TMM] queue number per network port, refer to ctc_qos_port_queue_num_t (default: CTC_QOS_PORT_QUEUE_NUM_8)*/
    uint8  queue_num_per_internal_port;     /**< [GB.D2.TM.TMM] queue number per internal port, for D2, mean extend port queue num (default: 8)*/
    uint8  queue_num_per_cpu_reason_group;  /**< [GB] queue number per cpu reason group (default: 8)*/
    uint8  queue_num_per_stk_port;          /**< [TMM] trunk member port queue mode(default: 0),
                                                       0: queue_num_per_network_port + 8(C2C uc&mc),
                                                       1: queue_num_per_network_port + 1(C2C uc) + 1(C2C mc)*/
    uint8  queue_aging_time;                /**< [GB] queue aging interval (uint:s), default  aging time is 30s (default: 30)*/
    uint8  max_cos_level;                   /**< [GG.D2.TM.TMM.AT] the max number of cos level in MEF BWP (default: 8)*/
    uint16 policer_num;                     /**< [GG] the max number of policer, support 1K/2K/4K/8K, default 4K
                                                      8K support 1G rate,  4K support 10G rate,
                                                      2K support 40G rate, 1K support 100G rate (default: 4096).
                                                      [D2.TM] alias port_policer_num, mean the max number of port policer, if value is 0, use default.(default 64)*/
    uint8  queue_num_for_cpu_reason;        /**< [GG.D2.TM.TMM] the queue number for cpu reason, support 128/64/32, (default: 128)*/
    uint8  cpu_queue_shape_profile_num;     /**< [GB.GG] cpu queue shape profile number, (default: 0)*/
    uint16 ingress_vlan_policer_num;        /**< [D2.TM] the max number of ingress vlan policer, (default: 0)*/
    uint16 egress_vlan_policer_num;         /**< [D2.TM] the max number of egress vlan policer, (default: 0)*/
    ctc_qos_resrc_pool_cfg_t resrc_pool;    /**< [GB.GG.D2.TM.TMM.TMA.AT] resource pool init value*/
    ctc_qos_resrc_pool_cfg_t resrc_pool2;   /**< [AT] resource pool init value of mc traffic*/
    uint8  policer_merge_mode;              /**< [TM.TMM.AT] 2 level policer merge compatible GG (default: 0)*/
    uint8 service_queue_mode;               /**< [D2.TM.TMM] service queue mode, default 0,
                                                             0:logic src port + dstport enq,
                                                             1:service id + dstport enq, (default: 0)*/
    uint8  queue_num_per_ingress_service;   /**< [GB] queue number per ingress service (default: 4)*/
    ctc_qos_policer_level_select_t  policer_level;/**< [D2.TM.TMM.AT] QoS policer vlan and port level*/
    uint8  priority_mode;                   /**< [GB.GG] priority mode,default 0,0:support 0-15 priority
                                                         1:support 0-63 priority,if GG or GB stacking with the chip which is not GG or GB, must select mode 0 (default: 0)*/
    uint8  policer_svc_mode;                /**< [TMM.AT] svc policer mode, if set, refer to ctc_qos_policer_svc_mode_flag_t*/
    uint16 igs_macro_policer_num;           /**< [TMM.AT] the max number of ingress reserve macro policer,
                                                       which ACL entry support micro and macro at the same time, (default: 16)*/
    uint16 egs_macro_policer_num;           /**< [TMM.AT] the max number of egress reserve macro policer,
                                                       which ACL entry support micro and macro at the same time, (default: 16)*/
    ctc_qos_glb_policer_num_t glb_policer_num;  /**< [AT] the max number of global policer */
};
typedef struct ctc_qos_global_cfg_s ctc_qos_global_cfg_t;

/**@} end of @defgroup qos QOS */

#ifdef __cplusplus
}
#endif

#endif

